<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="com.card.advice.*,java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta name="description" content="Administry - Admin Template by www.865171.cn" />
<meta name="keywords" content="Admin,Template" />
<!-- Favicons --> 
<link rel="shortcut icon" type="image/png" HREF="img/favicons/favicon.png"/>
<link rel="icon" type="image/png" HREF="img/favicons/favicon.png"/>
<link rel="apple-touch-icon" HREF="img/favicons/apple.png" />
<!-- Main Stylesheet --> 
<link rel="stylesheet" href="css/style.css" type="text/css" />
<!-- Colour Schemes
Default colour scheme is blue. Uncomment prefered stylesheet to use it.
<link rel="stylesheet" href="css/brown.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="css/gray.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="css/green.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/pink.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="css/red.css" type="text/css" media="screen" />
-->
<!-- Your Custom Stylesheet --> 
<link rel="stylesheet" href="css/custom.css" type="text/css" />
<!--swfobject - needed only if you require <video> tag support for older browsers -->
<script type="text/javascript" SRC="js/swfobject.js"></script>
<!-- jQuery with plugins -->
<script type="text/javascript" SRC="js/jquery-1.4.2.min.js"></script>
<!-- Could be loaded remotely from Google CDN : <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> -->
<script type="text/javascript" SRC="js/jquery.ui.core.min.js"></script>
<script type="text/javascript" SRC="js/jquery.ui.widget.min.js"></script>
<script type="text/javascript" SRC="js/jquery.ui.tabs.min.js"></script>
<!-- jQuery tooltips -->
<script type="text/javascript" SRC="js/jquery.tipTip.min.js"></script>
<!-- Superfish navigation -->
<script type="text/javascript" SRC="js/jquery.superfish.min.js"></script>
<script type="text/javascript" SRC="js/jquery.supersubs.min.js"></script>
<!-- jQuery form validation -->
<script type="text/javascript" SRC="js/jquery.validate_pack.js"></script>
<!-- jQuery popup box -->
<script type="text/javascript" SRC="js/jquery.nyroModal.pack.js"></script>
<!-- jQuery data tables -->
<script type="text/javascript" SRC="js/jquery.dataTables.min.js"></script>
<!-- Internet Explorer Fixes --> 
<!--[if IE]>
<link rel="stylesheet" type="text/css" media="all" href="css/ie.css"/>
<script src="js/html5.js"></script>
<![endif]-->
<!--Upgrade MSIE5.5-7 to be compatible with MSIE8: http://ie7-js.googlecode.com/svn/version/2.1(beta3)/IE8.js -->
<!--[if lt IE 8]>
<script src="js/IE8.js"></script>
<![endif]-->
<script type="text/javascript">
$(document).ready(function(){
	
	/* setup navigation, content boxes, etc... */
	Administry.setup();
	
	/* datatable */
	$('#gamedata').dataTable();
	
	/* expandable rows */
	Administry.expandableRows();
});

function remove_advice(a_id)
{
	var code = confirm("确认要改变吗?");
		
	if(code == true) {
	    $.ajax({
	   		type:"post",//请求方式
	  		url:"/GameServer/remove_data",//发送请求地址
	   		data:{type:'agent',id:a_id},
	  	 	success:function(data,textStatus){
	  	 		/* var mailbody = document.getElementById("mainbody");
	  	 	  	var cell = document.getElementById("tr"+a_id);
	  	 	  	if(cell!=undefined){
	  	 	     	mainbody.removeCremove_agentild(cell);
	  	 	  	}  */
	  	 		location.reload(true);
	   		}
	   	}); 
	}
}
function remove_agent(a_id)
{
	var code = confirm("确认要删除吗?");
		
	if(code == true) {
	    $.ajax({
	   		type:"post",//请求方式
	  		url:"/GameServer/remove_data",//发送请求地址
	   		data:{type:'agentrm',id:a_id},
	  	 	success:function(data,textStatus){
	  	 		var mailbody = document.getElementById("mainbody");
	  	 	  	var cell = document.getElementById("tr"+a_id);
	  	 	  	if(cell!=undefined){
	  	 	     	mainbody.removeChild(cell);
	  	 	  	} 
	   		}
	   	}); 
	}
}
</script>
</head>
<body>

<%
		List<Admin> adviceList=AdminManager.getInstance().getAgents();
%>
	<!-- Header -->
	<%@include file="head.jsp" %>
	<div id="page">
		<!-- Wrapper -->
		<div class="wrapper">
			<section class="column width8 first">
				<!-- <h3>代理信息</h3> -->
					<div class="clear">&nbsp;</div>
					<table class="display stylized" id="gamedata">
						<thead>
							<tr>
								<th>编号</th>
								<th>账号</th>
								<th>密码</th>
								<th>手机号</th>
								<th>房卡数</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody id="mainbody">
							<% 
							for(int i = 0;i < adviceList.size();i++){
								Admin advice = adviceList.get(i); 
							%>
							<tr class="gradeX" id="tr<%=advice.getId() %>">
								<td class="left"><%=advice.getId()%></td>
								<td class="left"><%=advice.getName()%></td>
								<td class="left"><%=advice.getPassword()%></td>
								<td class="left"><%=advice.getPhone()%></td>
								<td class="left"><%=advice.getGold()%></td>
								<td class="left">
							    	<input onclick="location.href='/GameServer/cz_log.jsp?id=<%=advice.getId() %>'" class="btn btn-red big" value="充值记录" size="8"/>
							    	<% 
										if(group == 1) {
									%>
								    	<input onclick="location.href='/GameServer/agent_cz.jsp?id=<%=advice.getId() %>'" class="btn btn-red big" value="充值" size="4"/>
								    	<input onclick="remove_advice('<%=advice.getId() %>');" class="btn btn-red big" value="<%=advice.getStateTtr() %>" size="4"/>
								    	<input onclick="remove_agent('<%=advice.getId() %>');" class="btn btn-red big" value="删除" size="4"/>
									<%		
										}
									%>
							    </td>
							</tr>
							<%
							}
							%>
						</tbody>
						<!-- <tfoot>
							<tr>
								<th>编号</th>
								<th>账号</th>
								<th>密码</th>
								<th>手机号</th>
								<th>房卡数</th>
								<th>操作</th>
							</tr>
						</tfoot> -->
					</table>
			</section>
		</div>
		<div>
			<p>
				<input type="submit" onclick="location.href='/GameServer/agent_add.jsp'" class="btn btn-red" value="添加代理"/>  
			</p>
		</div>
	</div>
	<footer id="bottom">
		<div class="wrapper-login">
			<p>Copyright &copy; 2017 <b><a HREF="http://www.lxkj.com" title="www.lxkj.com">www.lxkj.com</a></b> | Icons by <a HREF="http://www.lxkj.com">lxkj</a></p>
		</div>
	</footer>
	<script type="text/javascript" SRC="js/administry.js"></script>
</body>
</html>